package com.jeff.controller;

import com.jeff.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangjf
 * @ClassName OrderController
 * @Description: TODO
 * @date 2021/8/19 17:51
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 下单：插入订单表、扣减库存，模拟回滚
     *
     * @return
     */
    @GetMapping
    public String placeOrderCommit() {
        orderService.placeOrder("1", "product-1", 1);
        return "success";
    }
}
